package com.xiaobug.baselibrary.activitylifecallbacks;

import android.app.Activity;
import android.app.Application;
import android.os.Bundle;

import com.ljb.commlibrary.utils.ActivityCollector;
import com.ljb.commlibrary.utils.L;


/**
 * Activity管理类
 * Created by ljb on 2018/4/27.
 */

public class ActivityCollectorLC implements Application.ActivityLifecycleCallbacks {
    private final String TAG = getClass().getSimpleName();


    @Override
    public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
        L.e(TAG, "onActivityCreated: " + activity.getClass().getSimpleName());
        ActivityCollector.add(activity);
    }

    @Override
    public void onActivityStarted(Activity activity) {
//        L.e(TAG, "onActivityStarted: ");
    }

    @Override
    public void onActivityResumed(Activity activity) {
//        L.e(TAG, "onActivityResumed: ");
    }

    @Override
    public void onActivityPaused(Activity activity) {
//        L.e(TAG, "onActivityPaused: ");
    }

    @Override
    public void onActivityStopped(Activity activity) {
//        L.e(TAG, "onActivityStopped: ");
    }

    @Override
    public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
//        L.e(TAG, "onActivitySaveInstanceState: ");
    }

    @Override
    public void onActivityDestroyed(Activity activity) {
        L.e(TAG, "onActivityDestroyed: " + activity.getClass().getSimpleName());
        ActivityCollector.remove(activity);
    }
}
